package org.kumas.bigdata.hdfs3.serialization;

import org.kumas.bigdata.hdfs3.fsdirectory.FSDirectory;

import java.io.*;

/*************************************************
 * TODO_Kumas
 *  Author： KumasZhang
 *  DateTime： 2021-12-07 11:09
 *  Description： 
 **/
public class FsSerializations implements Serialization<FSDirectory> {

    @Override
    public void serialize(OutputStream out, FSDirectory fsDirectory) throws IOException {
        DataOutputStream dos = new DataOutputStream(out);
        fsDirectory.write(dos);
    }

    @Override
    public FSDirectory deserialize(InputStream in, FSDirectory fsDirectory) throws IOException {
        DataInputStream dis = new DataInputStream(in);
        fsDirectory.readFields(dis);
        return fsDirectory;
    }
}
